{
语法百题 解题报告：
 http://git.oschina.net/et0662/sznoi-grammar/ 
}
var
	a:array[1..3000] of char;
	i,len:integer;
	t:char;
	flag:boolean;
begin
	len:=0;
	while not eoln do
	begin
		read(t);
		inc(len);
		a[len]:=t;
	end;
	if len mod 2=0 then
		writeln('NO')
	else
	begin
		if a[(len+1) div 2 ] <> '&' then
			writeln('NO')
		else
		begin
			flag:=true;
			for i:=1 to len div 2 do
			begin
				if a[i]<>a[len+1-i] then
				begin
					flag:=false;
					break;
				end;
			end;
			if flag then
				writeln('YES')
			else
				writeln('NO');
		end;
	end;
end.
